﻿#include "QStyleSheetHelper.h"

QStyleSheetHelper::QStyleSheetHelper(QObject *parent) : QObject(parent)
{
    StyleSheetSettingHandler = new QSettings(tr(":/resource/StyleSheetSetting.ini"), QSettings::IniFormat);
    int FontIdentifier = QFontDatabase::addApplicationFont(":/resource/images/fontawesome-webfont.ttf");
    QString FontName = QFontDatabase::applicationFontFamilies(FontIdentifier).at(0);
    IconFont = QFont(FontName);
}

QStyleSheetHelper::~QStyleSheetHelper()
{

}

void QStyleSheetHelper::SetIcon(QLabel *LabelHandler, QChar Descriptor)
{
    int TitleFontPointSize = StyleSheetSettingHandler->
            value(tr("MENU_ICON_FONT_POINTSIZE/TITLE_ICON_POINTSIZE")).toInt();
    IconFont.setPointSize(TitleFontPointSize);
    LabelHandler->setFont(IconFont);
    LabelHandler->setText(Descriptor);
}

void QStyleSheetHelper::SetIcon(QPushButton *PushButtonHandler, QChar Descriptor)
{
    int PushButtonFontPointSize = StyleSheetSettingHandler->
            value(tr("MENU_ICON_FONT_POINTSIZE/BUTTON_ICON_POINTSIZE")).toInt();
    IconFont.setPointSize(PushButtonFontPointSize);
    PushButtonHandler->setFont(IconFont);
    PushButtonHandler->setText(Descriptor);
}
